package com.springcloud1.hystrixconsumer.controller;

import com.springcloud1.hystrixconsumer.microservice.Provider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private Provider provider;

    @GetMapping()
    public String get() {
        return provider.get();
    }

    @GetMapping("{name}")
    public String get(@PathVariable String name) {
        return provider.get(name);
    }
}
